﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordSections
    {
        public WordSection this[int index]
        {
            get { return new WordSection(_sections[index]) { Document = Document }; }
        }

        private Sections _sections;

        public WordDocument Document
        {
            get;
            internal set;
        }

        internal WordSections(Sections sections)
        {
            _sections = sections;
        }

        public WordSection Add(WordRange range = null, SectionStart sectionStart = SectionStart.wdSectionNewPage)
        {
            object rangeArg = range != null ? range._range : Type.Missing;
            return new WordSection(_sections.Add(ref rangeArg, sectionStart)) { Document = Document };
        }
    }
}
